<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row>
          <a-col :span="12">
            <a-form-item label="AOI结果" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select placeholder="请选择AOI结果" v-model="query1" allowClear>
                <a-select-option value="PASS">PASS</a-select-option>
                <a-select-option value="NG">NG</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="AOI结果描述" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="query3" placeholder="请输入AOI结果描述"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="SPI结果" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select placeholder="请选择SPI结果" v-model="query2" allowClear>
                <a-select-option value="PASS">PASS</a-select-option>
                <a-select-option value="NG">NG</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="SPI结果描述" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input v-model="query4" placeholder="请输入SPI结果描述"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
  </j-modal>
</template>

<script>

  import { httpAction,getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import '@/assets/less/TableExpand.less'
import JDate from '@/components/jeecg/JDate.vue'

export default {
    name: 'PcbUseEditModal',
    mixins: [JeecgListMixin],
    components: {
      JDate
    },
    data () {
        return {
          form: this.$form.createForm(this),
          title:"操作",
          width:1200,
          visible: false,
          confirmLoading: false,
          id:'',
          query1:'',
          query2:'',
          query3:'',
          query4:'',
          labelCol: {
            xs: { span: 24 },
            sm: { span: 5 },
          },
          wrapperCol: {
            xs: { span: 24 },
            sm: { span: 16 },
          },
            description: '编辑',

            url: {
                list:'',
                edit: '/storage/reportapi/pcbUseEdit',
            },
            dictOptions: {}
        }
    },
    computed: {

    },
    methods: {
      initDictConfig () {

      },
      handleCancel () {
        this.visible=false;
      },
      handleOk () {
        let httpurl =  this.url.edit;
        let method = 'post';
        let myData = {
          query1:this.query1,
          query2:this.query2,
          query3:this.query3,
          query4:this.query4,
          id:this.id
        }
        const that = this;
        httpAction(httpurl,myData,method).then((res)=>{
          if(res.success){
            that.$message.success(res.message);
            that.$emit('ok');
          }else{
            that.$message.warning(res.message);
            that.visible=false;
          }
        }).finally(() => {
          that.confirmLoading = false;
          that.visible=false;
        })


      },
      init(record){
          this.id = record.id;
          this.query1 = record.query1;
          this.query2 = record.query2;
          this.query3 = record.query3;
          this.query4 = record.query4;
          this.visible=true;
      }
    }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
